export CROSS:=arm-hismall-linux-
export CROSS:=arm-hisiv100-linux-
export CC:=$(CROSS)gcc
export AR:=$(CROSS)ar



LIBRSL = $(PWD)/../lib

INC_FLAGS := -I$(PWD)/../include
INC_FLAGS += -I.


CFLAGS := -static -Werror -Wall -g -c 
CFLAGS += -x c $(INC_FLAGS)


LDFLAGS := -L$(LIBRSL)/
LIBS := -lrsl -lpthread -lm

SRC  = $(wildcard *.c)

OBJS    = $(SRC:%.c=%.o)
EXE     = rsl


VPATH   = $(PWD) $(PWD)/objs

OBJPATH = $(PWD)/objs

$(OBJPATH)/$(EXE): $(OBJPATH) $(OBJS)
	cd $(OBJPATH);$(CC) -static  -o $(OBJPATH)/$(EXE) $(OBJS) $(LD_LIB) $(LDFLAGS) $(LIBS)
	cp -f $(OBJPATH)/$(EXE) ./
	cp -f $(OBJPATH)/$(EXE) $(HOME)/nfs/bin/
	
$(OBJPATH):
	mkdir -p $(OBJPATH)

$(OBJS): %.o: %.c
	$(CC) $(CFLAGS) $< -o $(OBJPATH)/$@


.PHONY:clean
clean:
	rm -rf $(OBJPATH)

	